clear all 
set more off 
set maxvar 15000 
clear matrix


* LEVELS 

	use "$Mydirectory1/3_Output/2_PooledData_analysis.dta", clear 
    keep if baseline_sample==1
    
    gen level = exp(log_father_baseline)
    
    levelsof decade, local(decades)
        foreach d of local decades {
        eststo clear
        
            di "`d'"
            reg fam_inc_real level [aw=wgt_sex_race] if decade==`d', robust 
            estimates store log`d'       

        }
        
        label var level "Level coefficient"

    
    #delimit ; 
    esttab log1910 log1920 log1930 log1940 log1950 log1960 log1970 using "$Mydirectory2/appendix_d/table_main_estimates_levels.tex", replace 
    booktabs nostar label  keep(level) nobase noomit nonote alignment(c c) width(\hsize) se(3) b(3) brackets
    mtitles("1910" "1920" "1930" "1940" "1950" "1960" "1970") 
    stats(N, fmt(%9.2gc) label("Observations"));
    #delimit cr 